import type { RouteObject } from 'react-router'
// import Home from '/@/wms/pages/home/index.tsx'
// import { ZoomLayout } from '@zoom-design/zoom-design-demo'
import { wmsRouter, ZoomWmsRouter } from '@zoom-design/wxzd-front'
import Layout from '/@/wms/components/layout.tsx'
import Home from '/@/wms/pages/home'
import type { DefaultNamespace, Namespace } from 'i18next/typescript/options'
import { TFunction } from 'i18next'
import TypeManageTable from '/@/wms/pages/type-manage'
import Login from '/@/wms/pages/login'

type CustomRoute = Omit<RouteObject, 'children'> & {
  name?: string
  children?: CustomRoute[]
}

const Router780 = ZoomWmsRouter.concat([

  {
    path: '/wms',
    children: [
      {
        path: '/wms/home',
        element: <Home />
      }
    ]
  },{
    path: '/system',
    children:[
      {
        path: '/system/type-manage',
        element: <TypeManageTable />
      }
    ]
  }
])

export const RouterConfig: CustomRoute[] = [
  {
    path:'/login',
    element:<Login />
  },
  {
    path: '/',
    element: <Layout />,
    children: Router780
  }
]

export const pRoute = <
  Ns extends Namespace = DefaultNamespace,
  KPrefix = undefined
>(
  t: TFunction<Ns, KPrefix>
) => {
  const wmsRouters = wmsRouter()

  wmsRouters.routes.push({
    path: '/wms',
    name: t('测试'),
    children: [
      // @ts-ignore
      {
        name: t('测试'),
        path: '/wms/home',
        // element:<></>
      }
    ]
  })
  wmsRouters.routes.push({
    path: '/system',
    name: t('系统管理'),
    children: [
      // @ts-ignore
      {
        name: t('类型管理'),
        path: '/system/type-manage',
        // element:<></>
      }
    ]
  })
  return { ...wmsRouters }
}
// const concat = RouterConfig
// export default RouterConfig
